// https://mp.weixin.qq.com/s?__biz=MzUxNjY5NTYxNA==&mid=2247488272&idx=2&sn=27008ae48890e5d3734a82350305447b&scene=21#wechat_redirect
// https://leetcode-cn.com/problems/remove-element/

#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    int removeElement(vector<int>& nums, int val) {
        int slow_index = 0;

        for (int fast_index = 0; fast_index < nums.size(); fast_index++) {
            if (nums[fast_index] != val) {
                nums[slow_index++] = nums[fast_index];
            }
        }
        
        return slow_index;
    }
};

int main()
{
    Solution object = Solution();
    vector<int> nums = {2};
    int val = 3;
    cout << object.removeElement(nums, val) << endl;
}